package com.enums;

/**
 * Created by Yuicon on 2016/11/4.
 */
public enum ArticleEnums implements StateEnum{

    GET_ARTICLE_SUCCESS(3,"获取文章成功"),
    GET_ARTICLEAREA_SUCCESS(2,"获取文章区块信息成功"),
    GET_ARTICLEINFO_SUCCESS(1,"获取文章信息成功");

    private int state;

    private String stateInfo;

    ArticleEnums(int state, String stateInfo){
        this.state = state;
        this.stateInfo = stateInfo;
    }

    @Override
    public int getState() {
        return state;
    }
    public void setState(int state) {
        this.state = state;
    }

    @Override
    public String getStateInfo() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }

    public static ArticleEnums stateOf(int index) {
        for (ArticleEnums state : values()) {
            if (state.getState() == index) {
                return state;
            }
        }
        return null;
    }
}
